year = eval(input())
month = eval(input())
day = eval(input())
days = 0
listmonth1 = [0,31,28,31,30,31,30,31,31,30,31,30,31]
listmonth2 = [0,31,29,31,30,31,30,31,31,30,31,30,31]
if year >= 1970:
    for i in range(1970,year):
        if (i % 100 == 0 and i % 400 == 0) or (i % 4 == 0 and i % 100 != 0):
            days += 366
        else:
            days += 365
    if (year % 100 == 0 and year % 400 == 0) or (year % 4 == 0 and year % 100 != 0):
        for i in range(0,month):
            days += listmonth2[i]
    else:
        for i in range(0,month):
            days += listmonth1[i]
    days += day
    print(days - 1)
elif year > 0 and year < 1970:
    for i in range(year + 1,1970):
        if (i % 100 == 0 and i % 400 == 0) or (i % 4 == 0 and i % 100 != 0):
            days += 366
        else:
            days += 365
    if (year % 100 == 0 and year % 400 == 0) or (year % 4 == 0 and year % 100 != 0):
        for i in range(month + 1,13):
            days += listmonth2[i]
        days += (listmonth2[month] - day + 1)
    else:
        for i in range(month + 1,13):
            days += listmonth1[i]
        days += (listmonth1[month] - day + 1)
    print(-days)
else:
    for i in range(year+1,1):
        if (i % 100 == 0 and i % 400 == 0) or (i % 4 == 0 and i % 100 != 0):
            days += 366
        else:
            days += 365
    if (year % 100 == 0 and year % 400 == 0) or (year % 4 == 0 and year % 100 != 0):
        for i in range(month + 1,13):
            days += listmonth2[i]
        days += (listmonth2[month] - day + 1)
    else:
        for i in range(month + 1,13):
            days += listmonth1[i]
        days += (listmonth1[month] - day + 1)
    print(-days-719162)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    